import { request } from '@umijs/max';
import { stringify } from 'qs';

//获取自己的收藏夹列表
export const getMyFavoitesFoldersList = () =>
  request(`/favorites_folders/list`, {
    method: 'GET',
  });
// 新增或修改收藏夹
export const editFavoritesFolders = (params: {
  /**
  * 名称
  */
  name?: null | string;
  /**
   * 权限
   */
  permission?: number | null;
}) =>
  request('/favorites_folders/add-or-update', {
    method: 'POST',
    data: params,
  });
//根据ID删除收藏夹
export const delFavoritesFolders = (id: string) =>
  request(`/favorites_folders/${id}`, {
    method: 'DELETE',
  });


//添加收藏
export const addFavorites = (params: {
  /**
     * 文章id
     */
  articleId: string;
  /**
   * 收藏夹ID
   */
  ffId: string[];
}) => request(`/favorites/add?ffIds=${params.ffId.map(i=>i)?.join(',')}&articleId=${params.articleId}`,{
  method: 'POST',
})

//获取收藏夹下的文章列表
export const getFavoiteFolderArticles = (ffid:string) =>request(`/article/follow?ffid=${ffid}`,{
  method: 'GET',
})

//删除一级评论
export const delComment = (id:string) =>request(`/comment/del/${id}`,{
  method:'DELETE'
})